package com.example.laboratory.api;


import com.example.laboratory.bean.*;
import com.example.laboratory.common.UrlConstainer;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.*;

import java.util.List;
import java.util.Map;


/**
 * 接口
 * Created by 位展朋 on.2020.2.24
 */
public interface ApiServer {
    /**
     * 登录
     * @param body
     * @return
     */
    @Headers("Content-Type:application/json")
    @POST(UrlConstainer.LOGIN)
    Observable<BaseBean<User>> login(@Body RequestBody body);


    @Headers("Content-Type:application/json")
    @GET(UrlConstainer.GETRECORDLIST)
    Observable<BaseBean<Record>> getRecordList(@Header("Authorization") String token,@Path("uid") String uid);



    @Headers("Content-Type:application/json")
    @POST(UrlConstainer.GETLABORATORYLIST)
    Observable<BaseBean<Laboratory>> getLaboratoryList(@Header("Authorization") String token, @Path("page") int page, @Path("size") int size,@Body RequestBody body);




    @Headers("Content-Type:application/json")
    @GET(UrlConstainer.GETDEPARTINFO)
    Observable<BaseBean<Depart>> getDepartInfo(@Header("Authorization") String token);



    @Headers("Content-Type:application/json")
    @GET(UrlConstainer.GETRESULTBYXJID)
    Observable<BaseBean<Result>> getResultByXjId(@Header("Authorization") String token,@Path("xjid") String xjid);


    /**
     * 获取items
     * @param token
     * @param labid
     * @return
     */
    @Headers("Content-Type:application/json")
    @GET(UrlConstainer.GETITEMSBYLABID)
    Observable<BaseBean<Items>> getItemsByLabId(@Header("Authorization") String token,@Path("labid") String labid);


    @Headers("Content-Type:application/json")
    @GET(UrlConstainer.GETITEMS)
    Observable<BaseBean<Items>> getItemsByBelong(@Header("Authorization") String token,@Path("belong") String belong);





    @Headers("Content-Type:application/json")
    @POST(UrlConstainer.ADDRESULTLIST)
    Observable<BaseBean<String>> addResultList(@Body RequestBody body);



    @Headers("Content-Type:application/json")
    @POST(UrlConstainer.ADDRECORD)
    Observable<BaseBean<String>> addRecord(@Body RequestBody body);



    @Headers("Content-Type:application/json")
    @POST(UrlConstainer.ADDLABS)
    Observable<BaseBean<String>> addLaboratory(@Body RequestBody body);





    /**
     * root
     *
     */
     @Headers("Content-Type:application/json")
     @POST(UrlConstainer.GETALLLABS)
     Observable<BaseBean<Laboratory>> getAllLabs(@Header("Authorization") String token);

    @Headers("Content-Type:application/json")
    @GET(UrlConstainer.GETUSERDEPARTID)
    Observable<BaseBean<UserList>> getUsersByDepartId(@Header("Authorization") String token,@Path("departId") String departId,@Path("permission") String permission);

    @Headers("Content-Type:application/json")
    @POST(UrlConstainer.ADDUSER)
    Observable<BaseBean<String>> AddUser(@Header("Authorization") String token,@Body RequestBody body);


}
